<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>t_free</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4>NAME</h4><blockquote>
t_free - free a library structure
</blockquote><h4>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="xti.h.html">xti.h</a>&gt;

int t_free(
    void *ptr,
    int struct_type)
</code>
</pre>
</blockquote><h4>DESCRIPTION</h4><blockquote>
<pre>
<P><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Parameters</b>
<th align=center><b>Before call</b>
<th align=center><b>After call</b>
<tr valign=top><td align=left>ptr
<td align=center>x
<td align=center>/
<tr valign=top><td align=left>struct_type
<td align=center>x
<td align=center>/
</table>
</pre>
<p>
The
<i>t_free()</i>
function frees memory previously allocated by
<i><a href="t_alloc.html">t_alloc()</a></i>.
This function will free memory for the specified structure, and
will also free memory for buffers referenced by the structure.
<p>
The argument
<I>ptr</I>
points to one of the seven structure types described for
<i><a href="t_alloc.html">t_alloc()</a></i>,
and
<I>struct_type</I>
identifies the type of that structure which must be one
of the following:
<pre>
<code>
T_BIND        struct    t_bind
T_CALL        struct    t_call
T_OPTMGMT     struct    t_optmgmt
T_DIS         struct    t_discon
T_UNITDATA    struct    t_unitdata
T_UDERROR     struct    t_uderr
T_INFO        struct    t_info
</code>
</pre>
<p>
where each of these structures is used as an argument to one or
more transport functions.
<p>
The function
<i>t_free()</i>
will check the
<I>addr</I>,
<I>opt</I>
and
<I>udata</I>
fields of the given structure (as appropriate) and free the
buffers pointed to by the
<I>buf</I>
field of the
<B>netbuf</B>
structure.
If
<I>buf</I>
is a null pointer,
<i>t_free()</i>
will not attempt to free memory.  After all buffers are freed,
<i>t_free()</i>
will free the memory associated with the structure pointed to by
<I>ptr</I>.
<p>
Undefined results will occur if
<I>ptr</I>
or any of the
<I>buf</I>
pointers points to a block of memory that was not previously allocated by
<i><a href="t_alloc.html">t_alloc()</a></i>.
</blockquote><h4>VALID STATES</h4><blockquote>
ALL - apart from T_UNINIT
</blockquote><h4>ERRORS</h4><blockquote>
On failure,
<I>t_errno</I>
is set to the following:
<dl compact>

<dt>[TNOSTRUCTYPE]<dd>Unsupported <I>struct_type</I> requested.

<dt>[TPROTO]<dd>This error indicates that a communication problem has been detected between
XTI and the transport provider for which there is no other suitable XTI
error
<I>(t_errno)</I>.

<dt>[TSYSERR]<dd>A system error has occurred during execution of this function.

</dl>
</blockquote><h4>RETURN VALUE</h4><blockquote>
Upon successful completion, a value of 0 is returned.  Otherwise,
a value of -1 is returned and
<I>t_errno</I>
is set to indicate an error.
</blockquote><h4>SEE ALSO</h4><blockquote>
<i><a href="t_alloc.html">t_alloc()</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
